import { createSSRApp } from 'vue'
import * as Pinia from 'pinia'
import AdaptiveNavBar from '@/components/AdaptiveNavBar'
import SvgIcon from '@/components/SvgIcon'
import FontIcon from '@/components/FontIcon'
import * as navbarUtil from '@/utils/navbarUtil'
import App from './App.vue'
import uviewPlus from 'uview-plus'
import './static/fonts/iconfont.css'

export function createApp() {
  const app = createSSRApp(App)
  // 安装uviewPlus
  app.use(uviewPlus)
  // 安装Pinia
  app.use(Pinia.createPinia())
  // 注册全局组件 - 保持组件名称一致性
  app.component('AdaptiveNavBar', AdaptiveNavBar)
  app.component('SvgIcon', SvgIcon)
  app.component('FontIcon', FontIcon)
  
  // 注册全局方法
  app.config.globalProperties.$navbarUtil = navbarUtil
  
  return {
    app,
    Pinia
  }
}